<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/embeds/taglibs.jsp"%>

<link href="<c:url value='/css/validate/validator.css'/>" rel="stylesheet"
	type="text/css" />
<script type="text/javascript" src="<c:url value='/js/validate/formValidator_min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/js/validate/formValidatorRegex.js'/>"></script>
<script type="text/javascript">
//+---------------------------------------------------  
//| 求两个时间的天数差 日期格式为 YYYY-MM-dd   
//+---------------------------------------------------  
function CompareDate(d1,d2)
{
if(d1 == d2){return false;}
return ((new Date(d1.replace(/-/g,"\/"))) > (new Date(d2.replace(/-/g,"\/"))));
} 
</script>
<%-- --------------------------发布商家信息验证  开始 ----------------------------%>
<c:if test="${fn:contains(pageContext.request.requestURI, 'businessForm')}">
<script type="text/javascript">
$(document).ready(function(){
	$.formValidator.initConfig({formid:"businessForm",onerror:function(msg){alert(msg)},onsuccess:function(){
		var locationID = $("#locationID").val();
		if(locationID == "" || locationID == undefined){
			alert("请选择具体的地区信息!");
			return false;
		}
	}});
	$("#realName").formValidator({onshow:"请输入真实姓名",onfocus:"真实姓名至少2个中文或4个字符",oncorrect:"输入正确"}).inputValidator({min:4,onerror:"请输入真实姓名，内容至少2个中文或4个字符"});
	$("#contact").formValidator({onshow:"请输入联系方式",onfocus:"请输入您的手机或者固定电话",oncorrect:"输入正确"}).inputValidator({min:6,max:15,onerror:"请输入正确的联系方式"}).regexValidator({regexp:"^[0-9]+$",onerror:"请输入正确的联系方式，手机或固话"});
	$("#businessName").formValidator({onshow:"请输入商家名称",onfocus:"名称至少2个中文或4个字符",oncorrect:"输入正确"}).inputValidator({min:4,onerror:"请输入商家名称，内容至少2个中文或4个字符"});
	$("#papers").formValidator({onshow:"请输入证件号",onfocus:"身份证或军官证等，至少10个字符",oncorrect:"输入正确"}).inputValidator({min:10,onerror:"请输入证件号，内容至少10个字符"});
	$("#address").formValidator({onshow:"请输入联系地址",onfocus:"请输入联系地址",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"联系地址不能为空"});
});
</script>
</c:if>
<%-- --------------------------发布商家信息验证  结束 ----------------------------%>

<%-- --------------------------发布商品类型或地区信息验证  开始 ----------------------------%>
<c:if test="${fn:contains(pageContext.request.requestURI, 'categoryForm') || fn:contains(pageContext.request.requestURI, 'locationForm')}">
<script type="text/javascript">
$(document).ready(function(){
	$.formValidator.initConfig({formid:"form",onerror:function(msg){alert(msg)},onsuccess:function(){
	}});
	$("#name").formValidator({onshow:"请输入名称",onfocus:"名称至少2个中文或4个字符",oncorrect:"输入正确"}).inputValidator({min:4,onerror:"请输入名称，至少2个中文或4个字符"});
});
</script>
</c:if>
<%-- --------------------------发布商品类型或地区信息验证   结束 ----------------------------%>